#include "Animal.h"

Animal::Animal(SDL_Surface * img, Point pos) :
	GameObject(img, pos),
	m_isAlive(true)
{

}
Animal::~Animal()
{
	
	
}
Point Animal::getPos()
{
	Point pos;
	pos.x = bound.x;
	pos.y = bound.y + bound.w;
	return pos;
}
void Animal::Update()
{
	// 
	frame++;
	if (rand() % 20 == 0)
	{
		m_isMoveLeft = !m_isMoveLeft;
	}
	if (m_isMoveLeft)
	{
		if (position.x < 20)
		{
			m_isMoveLeft = false;
			return;
		}
		Move(-6, 0);
	}
	else
	{
		if (position.x > WITCH - image->clip_rect.w)
		{
			m_isMoveLeft = true;
			return;
		}
		Move(6, 0);
	}
	GameObject::Update();
}
